package com.gufe.mapper.admin.preReserve;

import com.github.pagehelper.Page;
import com.gufe.dto.adminPreReserve.PreReserveMembersExcelDTO;
import com.gufe.dto.adminPreReserve.PreReservePageMembersDTO;
import com.gufe.dto.prereserve.PreReserveInfoDTO;
import com.gufe.entity.*;
import com.gufe.vo.adminPreReserve.PreReservePageMemberVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PreReserveMemberMapper {

    /*根据学号得到UserId*/
    @Select("select user_id from basic_info where student_id = #{studentId};")
    public Integer getUserIdByStudentId(String studentId);

    /*得到基本信息*/
    @Select("select * from basic_info where user_id = #{userId} ")
    BasicInfo getBasicInfo(Integer userId);

    //得到军事兴趣社团类信息
    @Select("select * from military_info where user_id = #{userId}")
    MilitaryInfo getMilitaryInfo(Integer userId);

    //得到服役信息
    @Select("select * from retired_info where user_id = #{userId}")
    RetiredInfo getRetiredInfo(Integer userId);

    //得到个人学习经历信息
    @Select("select * from study_experience_info where user_id = #{userId}")
    StudyExperienceInfo getStudentExperienceInfo(Integer userId);

    //得到预储信息
    @Select("select * from pre_enlistment_info where user_id = #{userId}")
    PreEnlistmentInfo getPreEnlistmentInfo(Integer userId);

    Page<PreReservePageMemberVO> getPageMembers(PreReservePageMembersDTO preReservePageMembersDTO);

    //动态得到excel数据
    List<PreReservePageMemberVO> getMembersExcel(@Param("dto")  PreReserveMembersExcelDTO dto);

    //删除预储成员信息
    @Delete("DELETE from basic_info where user_id = #{userId}")
    void deletBasic(Integer userId);
    @Delete("DELETE from military_info where user_id = #{userId}")
    void deleteMilitary(Integer userId);
    @Delete("DELETE from pre_enlistment_info where user_id = #{userId}")
    void deletePreEnlistment(Integer userId);
    @Delete("DELETE from study_experience_info where user_id = #{userId}")
    void deleteStudyExperience(Integer userId);


    void updateInfoDTO(PreReserveInfoDTO preReserveInfoDTO);
}
